//
//  FindCollectionViewCell.m
//  Travel assistant
//
//  Created by 王京 on 16/3/2.
//  Copyright © 2016年 旅游助手. All rights reserved.
//

#import "FindCollectionViewCell.h"

@implementation FindCollectionViewCell

-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        
        [self add];
        
        self.backgroundColor = [UIColor whiteColor];
    }
    return self;
}

- (void)add{
    
    self.imageV = [[UIImageView alloc]init];
    
    self.imageV.frame = CGRectMake(0, 0, self.contentView.frame.size.width,self.contentView.frame.size.height*0.6);
    
//    self.imageV.backgroundColor = [UIColor cyanColor];
    
    [self.contentView addSubview:self.imageV];
    
    self.titleLabel = [[UILabel alloc]init];
    
    self.titleLabel.frame = CGRectMake(0, CGRectGetMaxY(self.imageV.frame), CGRectGetWidth(self.imageV.frame), self.contentView.frame.size.height*0.1);
//    
    self.titleLabel.backgroundColor = [UIColor purpleColor];
    
    self.titleLabel.font = [UIFont systemFontOfSize:20];
    
    self.titleLabel.textColor = [UIColor whiteColor];
    
    [self.contentView addSubview:self.titleLabel];
    
    self.detailLabel = [[UILabel alloc]init];
    
    self.detailLabel.frame = CGRectMake(0, CGRectGetMaxY(self.titleLabel.frame), CGRectGetWidth(self.imageV.frame), self.contentView.frame.size.height*0.3);
    
    self.detailLabel.numberOfLines = 0;
    
    self.detailLabel.adjustsFontSizeToFitWidth = YES;
    
    self.detailLabel.backgroundColor = [UIColor purpleColor];
    
    self.detailLabel.textColor = [UIColor whiteColor];
    
    self.detailLabel.font = [UIFont systemFontOfSize:15];
    
    [self.contentView addSubview:self.detailLabel];
    
}

-(void)layoutSubviews{
    [super layoutSubviews];
    self.imageV.frame = CGRectMake(0, 60, self.contentView.frame.size.width,self.contentView.frame.size.height*0.5);
    self.titleLabel.frame = CGRectMake(0, CGRectGetMaxY(self.imageV.frame), CGRectGetWidth(self.imageV.frame), self.contentView.frame.size.height*0.1);
    self.detailLabel.frame = CGRectMake(0, CGRectGetMaxY(self.titleLabel.frame), CGRectGetWidth(self.imageV.frame), self.contentView.frame.size.height*0.32);
    
}


@end
